#pragma once
#ifndef __GLF_DEBUGGER_MACROS_H__
#define __GLF_DEBUGGER_MACROS_H__

#include <glf/config.h>

#if GLF_ENABLE_DEBUGGER

#include <glf/debugger/debugger.h>
#include <glf/core/event.h>
#include <vector>

namespace glf
{
namespace debugger
{

class Macros;

class Macros : public Module
{
	GLF_DECLARE_SINGLETON_WITH_DEP(Macros, Debugger)
public:
	struct Counter
	{
		static const uint BUFFER_SIZE = 30;
		uint mValues[BUFFER_SIZE];
	};

	static void MacroCallback(Macro* macro, Macro::EventType et, void* param, void* ud) {
		Macros* macros = static_cast<Macros*>(ud);
		
		macros->MacroCallback(macro, et, param);
	}

	virtual ~Macros();
	virtual void UpdateFrame();
	virtual void Parse(int type, PacketReader& in);

private:
	Macros();
	
	void MacroCallback(Macro* macro, Macro::EventType et, void* param);

    enum MessageType {
        // Debugger to Glf
        TELL_AVAILABLE_MACROS,
        PLAY,
        PAUSE,
        STOP,
        RECORD,
		SELECT,

		SENDLIST,
        
        // Glf to Debugger
        AVAILABLE_MACROS,
        END_OF_MACRO,
        END_OF_MACROS,
		SEND_PROGRESS,
		SAVE,
    };

	Macro* mCurrentMacro;
	enum Command {
		EC_NONE,
		EC_LIST_MACROS,
	} mCommand;

	std::vector<Macro*> mMacros;
};

} // end namespace debugger
} // end namespace glf

#endif // GLF_ENABLE_DEBUGGER

#endif // __GLF_DEBUGGER_PERF_COUNTERS_H__
